package com.merchant.home;



import java.io.IOException;
import java.io.InputStream;

import com.merchant.constant.Constants;
import com.merchant.util.LoadingDialog;
import com.umeng.analytics.MobclickAgent;
import com.zjxfood.merchant.activity.R;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.webkit.WebView;
import android.widget.ImageView;
import android.widget.TextView;

public class TiXianGZActivity extends Activity implements OnClickListener {
	private Context mContext;
	private WebView xiyi;
	private ImageView manage_title_back_image;// ����
	private TextView text_title;// ����
	private LoadingDialog dialog;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		super.onCreate(savedInstanceState);
		setContentView(R.layout.layouy_xiyi);
		dialog = new LoadingDialog(this);
		dialog.show();
		init();
		xieyi();
	}

	private void init() {
		manage_title_back_image = (ImageView) findViewById(R.id.manage_title_back_image);
		manage_title_back_image.setOnClickListener(this);
		text_title = (TextView) findViewById(R.id.manage_title_text);
		text_title.setText("食尚男女提现规则");
		xiyi = (WebView) findViewById(R.id.xiyi);
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
		case R.id.manage_title_back_image:
			finish();
			break;
		}
	}

	private void xieyi() {
		try {
			// InputStream is = getAssets().open("xieyi.txt");
			// int size = is.available();
			// byte[] buffer = new byte[size];
			// is.read(buffer);
			// is.close();
			// String text = new String(buffer, "GB2312");		
			xiyi.loadUrl(Constants.tixian);
			dialog.dismiss();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			// dialog.dismiss();
			throw new RuntimeException();
		}
	}

	public void onResume() {
		super.onResume();
		MobclickAgent.onResume(this);
	}

	public void onPause() {
		super.onPause();
		MobclickAgent.onPause(this);
	}
	// // ��ȡЭ���ļ�
	// public String getFromAssets(String fileName) {
	// String result = "";
	// try {
	// InputStream in = mContext.getResources().getAssets().open(fileName);
	// // ��ȡ�ļ����ֽ���
	// int lenght = in.available();
	// // ����byte����
	// byte[] buffer = new byte[lenght];
	// // ���ļ��е����ݶ���byte������
	// in.read(buffer);
	// result = EncodingUtils.getString(buffer, "GBK");
	// } catch (Exception e) {
	// e.printStackTrace();
	// }
	// return result;
	// }

}
